#! /usr/bin/python
# -*- coding: utf-8 -*-

from @Package@.action import @PROTO_PY@
import @Package@.action

import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import actionlib_msgs.msg
import std_msgs.msg

class @Class@(genpy.Message):
  _md5sum = "@Checksum@"
  _type = "@Package@/@Class@"
  _has_header = False
  _full_text = "Protobuf generated msg for @Package@::@Class@"
  __slots__ = ['action_goal','action_result','action_feedback']
  _slot_types = ['@Package@/@PROTO_H@ActionGoal','@Package@/@PROTO_H@ActionResult','@Package@/@PROTO_H@ActionFeedback']

  def __init__(self, *args, **kwds):
    if args or kwds:
      super(@Class@, self).__init__(*args, **kwds)
      if self.action_goal is None:
        self.action_goal = @Package@.action.@PROTO_H@ActionGoal()
      if self.action_result is None:
        self.action_result = @Package@.action.@PROTO_H@ActionResult()
      if self.action_feedback is None:
        self.action_feedback = @Package@.action.@PROTO_H@ActionFeedback()
    else:
      self.action_goal = @Package@.action.@PROTO_H@ActionGoal()
      self.action_result = @Package@.action.@PROTO_H@ActionResult()
      self.action_feedback = @Package@.action.@PROTO_H@ActionFeedback()

  def _get_types(self):
    return self._slot_types

  def serialize(self, buff):
    try:
      self.action_goal .serialize(buff)
      self.action_result .serialize(buff)
      self.action_feedback .serialize(buff)

    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  def deserialize(self, str):
    if python3:
      codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      if self.action_goal is None:
        self.action_goal = @Package@.action.@PROTO_H@ActionGoal()
      if self.action_result is None:
        self.action_result = @Package@.action.@PROTO_H@ActionResult()
      if self.action_feedback is None:
        self.action_feedback = @Package@.action.@PROTO_H@ActionFeedback()

      data_len = self.action_goal.deserializeData(str[start:])
      start += data_len
      data_len =  self.action_result.deserializeData(str[start:])
      start += data_len
      data_len =  self.action_feedback.deserializeData(str[start:])
      return self
      
    except struct.error as e:
      raise genpy.DeserializationError(e) 

  def serialize_numpy(self, buff, numpy):
    self.serialize(buff)

  def deserialize_numpy(self, str, numpy):
    self.deserialize(str)
    return self
